<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="C" uri="http://java.sun.com/jstl/core_rt" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <%--给元素绑定事件--%>
    <script>
        function gopage(pageName) {
            document.getElementById("currentPage").value=pageName;
            document.forms[0].submit();
        }
        function xx() {
            document.forms[0].submit();
        }
    </script>
</head>
<body>
<form action="/lol/employee" method="post" >
    <h3><a href="/employee?cmd=input"> 新增</a></h3>
    名称:<input name="username" value="${qo.username}" type="text">
    范围:<input name="minAge" value="${qo.minAge}" type="number">-<input name="maxAge" value="${qo.maxAge}" type="number">
    <input value="查找" type="submit">
    <a href="/login.jsp"><img src="${USER_IN_SESSION.username}"/>安全退出</a><br/>
    <table border="1" cellspacing="0" cellpadding="0">
        <tr>
            <th>id</th>
            <th>姓名</th>
            <th>密码</th>
            <th>年龄</th>
            <th>操作</th>
        </tr>
        <c:forEach var="emp" items="${result.data}" varStatus="vc">
            <tr class="trClassName">
                <td>${emp.id}</td>
                <td>${emp.username}</td>
                <td>${emp.password}</td>
                <td>${emp.age}</td>
                <td>
                    <a href="/lol/employee?cmd=delete&id=${emp.id}">删除</a>
                    <a href="/lol/employee?cmd=input&id=${emp.id}">编辑</a>
                </td>
            </tr>
        </c:forEach>
        <tr>
            <td colspan="5">
                <a href="#" onclick="gopage(1)">首页</a>
                <a href="#" onclick="gopage(${result.pervPage})">上一页</a>
                <a href="#" onclick="gopage(${result.nextPage})">下一页</a>
                <a href="#" onclick="gopage(${result.totalPage})">尾页</a>
                当前第${result.currentPage}/${result.totalPage}页 一共有${result.totalCount}条数据
                跳转到第<input name="currentPage" value="${result.currentPage}" id="currentPage" type="number" onchange="xx()">页
                每页<select name="pageSize">
                <option value="5" ${result.pageSize==5?"checked":''}>5</option>
                <option value="10" ${result.pageSize==10?"checked":''}>10</option>
                <option value="15" ${result.pageSize==15?"checked":''}>15</option>
            </select>条数据
            </td>
        </tr>
    </table>
</form>
</body>
</html>
